<script src="jquery-1.8.2.min.js" type="text/javascript" ></script>
<script>
$(document).ready(function() {
  /////////////////////////////////////////
  $('#clickid').click(function() {
    var j=0;
    var checked = $(this).is(':checked');
    $('.child input[type="checkbox"]').each(function(i,j){
 //     j.checked = true;
      j.checked = checked;
    });
  });
  /////////////////////////////////////////////
  $('.child input[type="checkbox"]').click(function(){
    var checked = $(this).is(':checked');
    if(checked == false){
      $('#clickid').removeAttr('checked');
    } else {
      var countCheckbox  = $('.child input[type="checkbox"]').size();
      var countCheckedCheckbox  = $('.child input[type="checkbox"]:checked').size();
      if(countCheckbox == countCheckedCheckbox){
        $('#clickid').attr('checked','true');
      }
    }
  });
});
</script>

<input id="clickid" type="checkbox">All</br>
<div class="child">
  <input type="checkbox">cricket</br>
  <input type="checkbox">cricket</br>
  <input type="checkbox">cricket</br>
  <input type="checkbox"> cricket</br>
  <input type="checkbox" >cricket</br>
  <input type="checkbox" >cricket</br>
  <input type="checkbox" >cricket</br>
</div>
